package com.ler.yrmall.webapp.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ler.yrmall.aspect.anno.AccessRecord;
import com.ler.yrmall.basic.Result;
import com.ler.yrmall.webapp.entity.LayoutEntity;
import com.ler.yrmall.webapp.service.LayoutService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * 仓库信息
 * @author Leron
 */
@AccessRecord
@RestController
@RequestMapping("/layout")
public class LayoutController {

    @Resource
    private LayoutService layoutService;

    @GetMapping("/list")
    public Result<List<LayoutEntity>> list() {
        return Result.ok(layoutService.list(Wrappers.<LayoutEntity>lambdaQuery().orderByAsc(LayoutEntity::getSort)));
    }

    @PostMapping("/save")
    public Result<?> save(@RequestBody List<LayoutEntity> list) {
        layoutService.save(list);
        return Result.ok();
    }

}
